package org.example.extension.beanFactoryPostProcessor;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

@Component
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
        System.out.println("CustomBeanFactoryPostProcessor.postProcessBeanFactory");
        BeanDefinition bd = beanFactory.getBeanDefinition("beanFactorySomeBean");
        bd.setScope(BeanDefinition.SCOPE_PROTOTYPE);
    }
}
